import 'package:flutter/material.dart';

// 接受传入的参数
class NewsPage extends StatefulWidget {
  final String title;
  const NewsPage({super.key, this.title="新闻"});

  @override
  State<NewsPage> createState() => _NewsPageState();
}

class _NewsPageState extends State<NewsPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title), // 获取定义的title
      ),
      body: const Center(
        child: Text("新闻页面"),
      ),
    );
  }
}